package com.zr.sms.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import com.zr.sms.model.Goodslist;
import com.zr.sms.service.SelectService;
import com.zr.sms.serviceimpl.SelectServiceImpl;

public class FindgoodslistServlet extends HttpServlet{
	SelectService s=new SelectServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		 doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		resp.setCharacterEncoding("utf-8");
		int gid=Integer.parseInt(req.getParameter("gid"));
		Goodslist g=s.selectGoodsListBySid(gid);
		String gcontent=g.getGcontent();
		JSONObject jobj=JSONObject.fromObject(gcontent);
		 PrintWriter out=resp.getWriter();
		 if(g.getGcontent()==null){
			 JSONObject obj=new JSONObject();
			 obj.put("msg","对不起订单不存在");
				out.write(obj.toString());
		 }else{
			
				out.write(jobj.toString());
				
		 }
		
		
	
	}

}
